import {request} from '@umijs/max';
import * as API from "@/services";


/** 期刊分期 分页检索请求 */
export async function queryJournalTemplates(params: API.JournalTemplatePageQueryParams): Promise<API.RespPageResult<API.JournalTemplate>> {
  return request('/api/v1/journal-template', {
    params,
  });
}

/** 期刊分期 详情请求 */
export async function queryJournalTemplate(bizId: API.EntityId): Promise<API.RespResult<API.JournalTemplate>> {
  return request(`/api/v1/journal-template/${bizId}`);
}

/** 期刊分期 创建请求 */
export async function createJournalTemplate(entity: API.JournalTemplate_Create): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-template`, {
    method: 'POST',
    data: entity,
  });
}

/** 期刊分期 修改请求 */
export async function modifyJournalTemplate(entity: API.JournalTemplate_Modify): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-template/${entity.id}`, {
    method: 'PUT',
    data: entity,
  });
}

/** 期刊分期 修改(部分)请求 */
export async function patchJournalTemplate(entity: API.JournalTemplate_Patch): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-template/${entity.id}`, {
    method: 'PATCH',
    data: entity,
  });
}

/** 期刊分期 删除请求 */
export async function deleteJournalTemplate(bizId: API.EntityId): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-template/${bizId}`, {
    method: 'DELETE',
  });
}

/** 期刊分期 批量删除请求 */
export async function deleteJournalTemplates(bizIds: API.EntityId[]): Promise<API.RespResult<any>> {
  return request(`/api/v1/journal-template`, {
    method: 'DELETE',
    data: {
      ids: bizIds,
    },
  });
}
